#include <regx51.h>

unsigned int Count=0;
unsigned char Flag=0;
void main()
{
	TMOD=0x02;
    TL0=0x9c;
    TH0=0x9c;
    ET0=1;
    EA=1;
    TR0=1;
    while(1)
    {
        P2=0x01<<Flag;
    }
}
void time0_service(void) interrupt 1
{
    Count++;
    if(Count==10000)
    {
        Count=0;
        Flag++;
        if(Flag==8)Flag=0;
    }
}